
% This is intended to draw Figure 8.

function [value] = figure8 (j_all, N)

global P

p_all = [0.81, 0.86, 0.91;
         0.83, 0.88, 0.93;
         0.85, 0.90, 0.95; 
         0.87, 0.92, 0.97;   
         0.89, 0.94, 0.99];

value = zeros(1, 5);

for i = 1:5
    P = p_all (i,:);
    [ ~, profit_pro, ~, ~, ~ ] = prop_policy(j_all, N);
    [ profit_pmax, situation ] = max(profit_pro);
    [~, profit_rrall,~ ,~ ,~ ] = round_robin (j_all, N);
    profit_rmax = profit_rrall (1, situation);
    value(1,i) =  (profit_pmax - profit_rmax) / profit_pmax*100;
end

figure(8)
plot(value, 'ko--')
xlabel('p (Low no-show rates with constant variance)');
ylabel('% difference in objective');
title('Fig 8: Percentage difference in objective');
ylim([0.4 0.6]);
tick={'(0.81,0.86,0.91)' '(0.83,0.88,0.93)' '(0.85,0.90,0.95)' '(0.87,0.92,0.97)' '(0.89,0.94,0.99)'};
set(gca,'xtick',[ 1 2 3 4 5]);
set(gca,'XTickLabel',tick);

end